package cn.hncj.lyc.controller.back;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.hncj.lyc.bean.UserAdmin;

import cn.hncj.lyc.service.AdminLoginService;


@Controller
@RequestMapping("/back/")
public class AdminLoginController {
	@Autowired
	AdminLoginService adminLoginService;
	
	@RequestMapping("login")
	public String login(){
		return "back/login_back";
	}
	
	@RequestMapping("login_back")
	public String login(UserAdmin useradmin,HttpSession session ,Model model){
		UserAdmin loginuseradmin = adminLoginService.adminLogin(useradmin);
		if(loginuseradmin != null){			
			session.setAttribute("loginuseradmin", loginuseradmin);
			return "index";
		}else{
		   return "back/login_back";
		}
	}
   
}
